package Commom;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import model.Staff;

public class Constants {

    public static Staff staff;

    public static char[] syb = {'~', '!', '@', '#', '$', '%', '%', '%', '^', '&', '*', '(', ')', '-'};
    public static char[] num = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

    public static boolean checkNum(String s) {
        Pattern pattern = Pattern.compile("[0-9]*");
        Matcher matcher = pattern.matcher(s);
        if (matcher.matches()) {
           return true;
        } else {
            return false;
        }
    }

    public static String convertDateToString(Date date, String format) {
        SimpleDateFormat d = new SimpleDateFormat(format);
        return d.format(date);
    }

    public static Date convertStringToDate(String dateStr, String format) {
        SimpleDateFormat d = new SimpleDateFormat(format);
        try {
            return d.parse(dateStr);
        } catch (ParseException e) {
            return null;
        }
    }
}
